#include <iostream>
using namespace std;
#include <pthread.h>
#include <unistd.h>


void* routine(void* argv)
{
    while (1)
    {
        cout << "new thread, pid: " << getpid() << endl;
        sleep(1);
    }
}


int main()
{
    pthread_t thread;
    pthread_create(&thread, nullptr, routine, nullptr);

    while (1)
    {
        cout << "Main thread, pid: " << getpid() << endl;
        sleep(1);
    }
    return 0;
}